const express = require('express')
const app = express()
const loginRouter = require('./routers/loginRouter')
const userRouter = require('./routers/userRouter')
const versionKey = require('./middlewares/verifyToken')
// const setCORS = require('./middlewares/setCORS')
//解析请求体中间键
app.use(express.urlencoded({extended:false}))
app.use(express.json({extended:false}))//解析json格式的请求体
//设置允许跨域
// app.use(setCORS)
//暴露公共文件
app.use(express.static(__dirname+'/public'))

app.use(loginRouter)
app.use('/admin/user',versionKey,userRouter)
app.listen(8081,()=>{
    console.log('服务启动成功');
    
})